package com.ny;

import com.ny.mapper.UserMapper;
import com.ny.utils.DatabaseUpdater;
import com.ny.utils.TestEmailSender;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

@SpringBootApplication
public class NewIot4Application {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(NewIot4Application.class, args);
        
        // 更新数据库中的邮箱信息
        DatabaseUpdater databaseUpdater = context.getBean(DatabaseUpdater.class);
        int result = databaseUpdater.updateEmail(1, "1767293145@qq.com");
        if (result > 0) {
            System.out.println("成功将用户ID为1的邮箱更新为: 1767293145@qq.com");
        } else {
            System.out.println("更新邮箱失败");
        }
        
        // 测试发送验证码
        TestEmailSender testEmailSender = context.getBean(TestEmailSender.class);
        testEmailSender.testSendVerificationCode("1767293145@qq.com");
    }

}
